import os
import shutil

# 获取当前目录
current_dir = os.getcwd()

# 创建目标文件夹
target_dir = os.path.join(current_dir, 'VirusShare_00477')
os.makedirs(target_dir, exist_ok=True)

# 遍历当前目录下的文件
for filename in os.listdir(current_dir):
    if filename.startswith('VirusShare_'):
        # 提取hash值
        hash_value = filename.split('_')[1]
        # 检查文件名格式是否为"VirusShare_"+hash值
        if len(hash_value) == 32 and all(c in '0123456789abcdef' for c in hash_value):
            # 移动文件到目标文件夹
            shutil.move(os.path.join(current_dir, filename), os.path.join(target_dir, filename))

print("Files moved successfully.")